/**
 * Created by zq on 2017/1/14.
 */
//单独日期设置
$("[setDate]").each(function (k, v) {
    $.get($(v).attr("setDate"), function (html) {
        var obj = $(v).attr('id');
        var objFormat=$(v).attr('setDataFormat');
        laydate({
            elem: '#'+obj,
            event: 'focus',
            format:objFormat,
        });
    });
})
//开始-结束日期设置
$("[setStartDate]").each(function (k, v) {
    $.get($(v).attr("setStartDate"), function (html) {
        var strObj = $(v).attr('id');
        var endObj = $('[setEndDate]').eq(k).attr('id');
        var strObjFormat=$(v).attr('setDataFormat');
        var endObjFormat=$('[setEndDate]').eq(k).attr('setDataFormat');
        var start = {
            elem: '#'+strObj,
            format: strObjFormat,
            choose: function(datas){
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#'+endObj,
            format: endObjFormat,
            istime: true,
            istoday: false,
            choose: function(datas){
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
    });
})